package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.RealUserListDto;
import com.heima.user.service.ApUserService;
import com.heima.user.service.RealUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ybw
 * @version 1.0
 * @date 2021/12/22 13:52
 */
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserAuthController {
  @Autowired private RealUserService realUserService;
  /**
   * 真实用户审核列表
   *
   * @param dto
   * @return
   */
  @PostMapping("/list")
  public ResponseResult authUserList(@RequestBody RealUserListDto dto) {
    return realUserService.authUserList(dto);
  }

  /**
   * 审核成功
   *
   * @param dto
   * @return
   */
  @PostMapping("/authPass")
  public ResponseResult authPass(@RequestBody RealUserListDto dto) {
    return realUserService.auth(dto,1);
  }

  /**
   * 审核失败
   *
   * @param dto
   * @return
   */
  @PostMapping("/authFail")
  public ResponseResult authFail(@RequestBody RealUserListDto dto) {
    return realUserService.auth(dto,0);
  }
}
